package com.slkj.shilixiaoyuanapp.net.service;

import com.slkj.shilixiaoyuanapp.entity.UpFileEntity;
import com.slkj.shilixiaoyuanapp.net.CommonResult;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

public interface FileService {
    /*
    * 上传图片
    * */

    @Multipart
    @POST("upload/uploadImage.do")
    Observable<CommonResult<List<String>>> updateImg(@PartMap Map<String,RequestBody> map, @Part MultipartBody.Part... file);
    /*
     * 上传文件
     * */
    @Multipart
    @POST("upload/uploadFile.do")
    Observable<CommonResult<List<UpFileEntity>>> updateFile(@PartMap Map<String,RequestBody> map, @Part() MultipartBody.Part... file);

    /**
     * 下载文件
     * @param fileUrl
     * @return
     */
    @Streaming
    @GET
    Observable<Response<ResponseBody>> downloadFile(@Url String fileUrl);
}
